<?php

/**
 * Esta clase dibuja los links solo si tenes permisos para accederlos
 *
 * TODO: Usar decorators para dibujar el link.
 */
class Ext_View_Helper_Href extends Zend_View_Helper_Abstract
{

    /**
     * Generates an url given the name of a route.
     *
     * @access public
     *
     * @param  string $controller
     * @param  string $action
     * @param  string $desc description
     * @param  string $args array of arguments
     * @return string Url for the link href attribute.
     */
    public function href( $controller, $action, $desc, $args = array(), $extraFmt =  "%s", $module = null, $reset = true)
    {
		$url = $this->view->surl($controller, $action, $args, $extraFmt, $module, $reset );
		if ( ! empty( $url ) ) {
            $ret = '<a href="' . $url;
            $ret .= '">' . $desc . '</a>';
            return sprintf( $extraFmt, $ret );
        }
    }

}
